<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/templates/modelo.xhtml">

	<ui:define name="centro">
		<p:panel id="pnReqPesq" header="Locais -> Pesquisar"
			rendered="#{localBacking.acao == 'pesquisar'}">
			<h:form id="frmRecPesq" prependId="false">
				<h:panelGrid columns="4">
					<h:outputLabel for="txtRecPesquisa" value="Descrição:" />
					<p:inputText id="txtRecPesquisa" size="40" maxlength="50"
						value="#{localBacking.pesquisa}" />

					<p:commandButton icon="ui-icon-search" type="submit" ajax="false"
						actionListener="#{localBacking.buscar}" />
					<p:commandButton icon="ui-icon-plus" type="submit"
						actionListener="#{localBacking.novo}" ajax="false" />
				</h:panelGrid>

				<p:dataTable id="dtTblRec" emptyMessage=""
					value="#{localBacking.locais}" var="rec" paginator="true"
					rows="5">

					<p:column>
						<f:facet name="header">
							<h:outputText value="Descrição" />
						</f:facet>
						<h:outputText value="#{rec.descricao}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="Opções" />
						</f:facet>
						<p:commandButton icon="ui-icon-trash"
							actionListener="#{localBacking.excluir}" ajax="false"
							type="submit" />
						<p:commandButton icon="ui-icon-pencil"
							actionListener="#{localBacking.editar}" ajax="false"
							type="submit" />
					</p:column>
				</p:dataTable>
			</h:form>
		</p:panel>

		<p:panel header="Locais -> Novo"
			rendered="#{localBacking.acao != 'pesquisar'}">
			<h:form id="frmRecOp">
				<h:panelGrid columns="2">
					<h:outputLabel for="txtRecDesc" value="Descrição:" />
					<p:inputText id="txtRecDesc"
						value="#{localBacking.local.descricao}" size="40"
						maxlength="50" required="true"
						requiredMessage="O campo Descrição é obrigatório!"
						disabled="#{localBacking.acao == 'excluir'}" />

				</h:panelGrid>

				<h:panelGrid columns="4">
					<p:commandButton icon="ui-icon-check" type="submit"
						actionListener="#{localBacking.confirmar}" ajax="false" />

					<p:commandButton icon="ui-icon-close" type="submit" ajax="false"
						actionListener="#{localBacking.iniciar}" immediate="true" />
				</h:panelGrid>
			</h:form>
		</p:panel>
	</ui:define>
</ui:composition>


